$("document").ready(function () {

    // DROPDOWN MENU

    $("ul.nav li").hover(function () {

        $(this).addClass("hover");
        $('ul:first', this).css('visibility', 'visible');

    }, function () {

        $(this).removeClass("hover");
        $('ul:first', this).css('visibility', 'hidden');

    });
    $("ul.nav li").click(function () {

        if (this.className.indexOf('current') == -1) {
           // contentWrapper.hide();
           // contentWrapper.filter(this.hash).fadeIn(500);
            $('ul.nav li').removeClass('current');
            $(this).addClass('current');
            $('ul:first', this).css('visibility', 'hidden');
        }

    });
    // HOMEPAGE SLIDESHOW

    $(".featured").cycle({
       // fx: 'toss',
             speedIn: 2000,
             speedOut: 500,
              overlayShow: true,
              overlayOpacity: 0.5,
             overlayColor: '#FF0000',
              transitionIn : 'elastic',
              transitionOut : 'elastic',
              showCloseButton: 'true',
              showNavArrows : 'true',
              enableEscapeButton : 'true',
              easingIn: 'easeOutBounce',
              easingOut: 'easeInBack',
              hideOnContentClick: false,    
        //region jum 
       // //fx:      'scrollVert,scrollHorz',
//        fx: 'curtainX,scrollHorz',
//        timeout: 5000,
//        speend: 1000,
//        speedIn: 800,
//        speedOut: 200,
//        transitionIn: 'elastic',
//        transitionOut: 'elastic',
//        // easeIn:  'bounceout', 
//        //       easeIn: 'easeInOutCubic',
//        //        easeOut: 'backin',
//        //enregion
        next: '.featured-nav a.next',
        prev: '.featured-nav a.prev'

    });

    // PROJECT SLIDESHOW

    $(function () {
        var contentWrapper = $('.project-wrap > .project');
        // only show the first item, hide the rest
      //  contentWrapper.hide().filter(':first').show();

        $('.project-nav li a').click(function () {

            // check if this item doesn't have class "current"
            // if it has class "current" it must not execute the script again
            if (this.className.indexOf('current') == -1) {
               contentWrapper.hide();
                contentWrapper.filter(this.hash).fadeIn(500);
                $('.project-nav li').removeClass('current');
                $('.project-nav li a').removeClass('current');
                $(this).addClass('current');
                $(this).parent().addClass('current');
            }
            return true;
        });
    });

    // CONTACT FORM

    $('#contactform').ajaxForm({
        target: '#error',
        beforeSubmit: function () {
            $('#error span').remove();
            $('#error').append('<p class="loading">Sending your message...</p>');
        },
        success: function () {
            $('#error p.loading').fadeOut();
            $('#error').fadeIn('slow');
        }
    });

});